package com.example.a001.part25;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.fragment.app.Fragment;

import com.example.a001.R;


public class MyFragment extends Fragment {

    private static final String ARG_CONTENT = "content";

    public static MyFragment newInstance(String content) {
        MyFragment fragment = new MyFragment();
        Bundle args = new Bundle();
        args.putString(ARG_CONTENT, content);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.my_fragment, container, false);
        TextView tvContent = view.findViewById(R.id.tv_content);
        if (getArguments() != null) {
            tvContent.setText(getArguments().getString(ARG_CONTENT));
        }
        return view;
    }
}